import WoodenBox from './components/woodenBox'
import Mirror from './components/mirror'
import CameraArray from './components/cameraArray'

const root = document.getElementById('root');

let instance = null;
// 清除按钮
const clearDom = document.getElementById('clear')
clearDom.onclick = function () {
  if(!instance) {
    return;
  }
  instance.renderer.clear();
  instance.renderer.dispose();
  for(const node of root.childNodes) {
    root.removeChild(node)
  }  
}


const cameraArray = document.getElementById('cameraArray')
cameraArray.onclick = function () {
  instance = new CameraArray(root)
}

const mirror = document.getElementById('mirror')
mirror.onclick = function () {
  instance = new Mirror(root)
}

const woodenBox = document.getElementById('woodenBox')
woodenBox.onclick = function () {
  instance = new WoodenBox(root)
}
